﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevComponents.DotNetBar.Controls;

namespace AppAcc.FormDieuKien
{
    public partial class FormDieuKienSoChiTietVatLieuDungCu : Form
    {
        public FormDieuKienSoChiTietVatLieuDungCu()
        {
            InitializeComponent();
        }

        private void FormDieuKienSoChiTietVatLieuDungCu_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dS_GetListTaiKhoan.TaiKhoan' table. You can move, or remove it, as needed.
            this.taiKhoanTableAdapter.Fill(this.dS_GetListTaiKhoan.TaiKhoan);
            getListTenTaiKhoan();
            getList_Ma_TenHH();
        }

        void getListTenTaiKhoan()
        {
            this.pr_GetListTenTaiKhoanTableAdapter.Fill(this.dS_GetListTenTK.pr_GetListTenTaiKhoan,
                cbbX_TaiKhoan.SelectedValue.ToString());
        }

        void getList_Ma_TenHH()
        {
            this.pr_Ma_TenHangHoaTableAdapter.Fill(this.dS_Ma_TenHH.pr_Ma_TenHangHoa,
                cbbX_TaiKhoan.SelectedValue.ToString());
        }

        private void cbbX_TaiKhoan_SelectedIndexChanged(object sender, EventArgs e)
        {
            getListTenTaiKhoan();
            getList_Ma_TenHH();
        }

        private void button1_Click(object sender, EventArgs e)
        {
           check_Hang();
        }

        void check_Hang()
        {
            var n = dvg_HangHoa.Columns[0] as DataGridViewCheckBoxXColumn;
            for (int i = 0; i <= dvg_HangHoa.Rows.Count - 1; i++)
            {
                textBox1.Text = dvg_HangHoa.Columns[1].ToString();
            }

        }
        void TaoChecKBox()
        {
         
        }

        private void dvg_HangHoa_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            
       // check_Hang();
        }

        private void dvg_HangHoa_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            for (int i = 0; i <= dvg_HangHoa.Rows.Count - 1;i++ )
            {
                        textBox1.Text = dvg_HangHoa.Rows[i].Cells[2].Value.ToString(); 
             }
                
        }

        private void dvg_HangHoa_MouseClick(object sender, MouseEventArgs e)
        {
            textBox1.Text = dvg_HangHoa.CurrentRow.Cells[2].Value.ToString();
        }
    }
}
